<{include file="top.html" }>
</head>
<body>
<{include file="signBody.html"}>
<div class="xy-panel">
    <div class="xy-panel-top">
        <div class="xy-titlebar">
            <div class="xy-titlebar-left">
                <a class="insertBefore_left_arrow_gray left_link" href="javascript:void(0);"></a>
            </div>
            <div class="xy-titlebar-title">历史卡券</div>
            <div class="xy-titlebar-right">
                <div class="spacer"></div>
                <{*<a href="javascript:void(0);">帮助</a>*}>
            </div>
        </div>
    </div>
    <div class="xy-panel-content" style="bottom:0;">
       <{if $list}>
        <ul class="ticketList">
            <{include file="Card/item.html" }>
        </ul>
<{else}>
			<div class="none-box">
                <span class="card-icon"></span>
                <dl>没有历史卡券</dl>
            </div>
<{/if}>
    </div>
</div>

</body>
</html>
<script>


    //拖动加载
    //    var  flagData  =  true;
    //    var  flagAjax  =  true;
    //    var  page      =  1;
    //    //加载
    var $list = $("#theList");
    var $listParent = $list.parent();
    var isLoading = false;
    var page = 1;
    function  load_more(postData){
        isLoading = true;
        if(postData == null){
            postData = {page:page,pos:"cardListMore"};
        }
        $("#load_more").css({'background':'url("<{$preStaticUrl}>Wap/images/load.gif")  center  center  no-repeat;background-size:30px  30px;'});
        $("#load_more  span").html('正在加载...');

        $.post("<{u('historyMore')}>",postData  ,  function(data){
            if(data.data)  {
                $(".append-html").append(data.data);
                $("#load_more  span").html('加载更多');
                page++;
                $("#load_more").css({'background':'url("<{$preStaticUrl}>Wap/images/load.gif")  center  center  no-repeat;background-size:30px  30px;'});
            }  else  {
                flagData  =  false;
                $("#load_container").html('<a  href="javascript:;"  id="load_more"><span>没有更多活动啦</span></a>');
                $("#load_more").css({'background':'url("")'}).css({'padding-top':'0'}).css({'top':'-30px'}).css({'position':'relative'});
            }
        },'json');
        isLoading = false;
    }
    var  tmp_scroll  =  0;
    //拖动加载
    function  scroll_load(postData){
        if  (tmp_scroll  ==  $(window).height()  +  $(window).scrollTop())  {
            return;
        }
        tmp_scroll  =  $(window).height()  +  $(window).scrollTop();
        var  jia_scroll  =  $(document).height()  -  ($(window).height()  +  $(window).scrollTop());
        if  (jia_scroll  <  100  &&  flagData)  {
            load_more(postData);
        }
    }
    $listParent.scroll(function(){
        if(isLoading)return;
        var v = $list.height() - $listParent.height() - $listParent.scrollTop();
//        console.log($listParent.scrollTop() + "  " + v);
        if(v < 10)
        {
            load_more({page:page,pos:"cardListMore"});
        }
//        scroll_load({page:page,pos:"cardListMore"});
    });


</script>


